import {
	defineStore
} from 'pinia'

import {
	ref
} from 'vue'
export let userStore = defineStore("user", () => {

	let userInfo = ref({})
	let isLogin = ref(false)
	let currentPos = ref({
		longitude: 108.9397,
		latitude: 34.342

	})
	let hasPos = ref(false)

	function addUserInfo(id, username, mobile) {
		//自行添加内容
		this.userInfo.id = id
		this.userInfo.username = username;
		this.userInfo.mobile = mobile;
		this.isLogin = true
	}
	// 清除用户登录状态
	function clearUserInfo() {
		//自行添加内容
	}

	function setPos(latitude, longitude) {
		currentPos.value.latitude = latitude
		currentPos.value.longitude = longitude
		hasPos.value = true

	}


	return {
		userInfo,
		isLogin,
		addUserInfo,
		clearUserInfo,
		setPos,
		currentPos,
		hasPos
	}
})